Skip to content

fix(replays): Bound recording uncompressed size without scrubbing - #6587

Open
sentry-junior[bot] wants to merge 13 commits into
masterfrom
dominikbuszowiecki/replay-994-bound-recording-uncompressed-size
Open

sentry-junior[bot] wants to merge 13 commits into
masterfrom
dominikbuszowiecki/replay-994-bound-recording-uncompressed-size

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Companion to getsentry/sentry#129541.

Relay already caps a replay recording at max_replay_uncompressed_size (100 MiB by default) once it is decompressed, but only inside RecordingScrubber. That code runs only for projects that have recording scrubbing turned on and a non-empty PII config. For every other project, only the 10 MiB compressed limit is checked, so a small zlib payload can be stored that inflates to any size every time it is read.

The check now lives in the recording scrubbing step, which runs after filtering and quotas, so each recording is decompressed at most once:

  • When recording scrubbing runs, its own decompression enforces the limit. It now reads one byte past the limit and returns ParseRecordingError::TooLarge, instead of truncating and failing on JSON parsing. That maps to TooLarge, which records an ItemTooLarge(ReplayRecording) outcome instead of InvalidReplayRecordingEvent.
  • When recording scrubbing does not run, processing Relays call relay_replays::recording::validate_recording. It uses the same header split and decompression helper as the scrubber, but inflates into a sink, so it never buffers the output. Only TooLarge is rejected there. Other malformed recordings, including bodies that are not valid zlib, are left to the consumer as before. Uncompressed JSON bodies are not checked.

TooLarge loses its processing cfg gate because scrubbing can now return it in both configurations.

Refs REPLAY-994

via @DominikB2014.

--

View Session [Sentry]

Recording scrubbing already enforces max_replay_uncompressed_size, but
only for projects that scrub recordings. Check the inflated size of every
recording in processing Relays so the limit applies regardless.

Refs REPLAY-994

Co-Authored-By: Dominik Buszowiecki <44422760+DominikB2014@users.noreply.github.com>
@linear-code

linear-code Bot commented Oct 28, 2026

Copy link
Copy Markdown

REPLAY-994

Co-Authored-By: Dominik Buszowiecki <44422760+DominikB2014@users.noreply.github.com>
@DominikB2014

Copy link
Copy Markdown
Contributor

@cursor review

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Move the size check out of validation, which ran before filtering and
quotas, into the recording scrubbing step. Scrubbing now reports an
explicit TooLarge error from its own decompression, and processing
Relays without recording scrubbing run the same decompression helper
to check the size, so each recording is decompressed at most once.
…replay-994-bound-recording-uncompressed-size

# Conflicts:
#	CHANGELOG.md
Comment thread relay-replays/src/recording.rs Resolved
Comment thread relay-replays/src/recording.rs Resolved
Comment thread relay-replays/src/recording.rs Resolved
Rename validate_recording to check_recording_size and document that
callers may pass malformed recordings through, and rename
scrub_recordings to process_recordings since it also enforces the
size limit without scrubbing.

Add integration tests for processing Relays without recording
scrubbing and without a PII config, covering recordings at and over
max_replay_uncompressed_size.
@DominikB2014

Copy link
Copy Markdown
Contributor

@cursor review

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

…replay-994-bound-recording-uncompressed-size

Co-Authored-By: Dominik Buszowiecki <44422760+DominikB2014@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md
@sentry-junior
sentry-junior Bot requested a review from vjeranc November 9, 2026 16:41

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b9a3679. Configure here.

Comment thread CHANGELOG.md Resolved
sentry-junior Bot and others added 2 commits November 13, 2026 16:00
…replay-994-bound-recording-uncompressed-size

Co-Authored-By: Dominik Buszowiecki <44422760+DominikB2014@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md
Run all three scrubbing configurations against a single processing Relay and
one pair of consumers. Each project receives one recording at the limit and
one over it, and the test collects the accepted recordings and rejection
outcomes by project instead of parametrizing six separate setups.

Refs REPLAY-994

Co-Authored-By: Dominik Buszowiecki <44422760+DominikB2014@users.noreply.github.com>
@DominikB2014
DominikB2014 requested a review from vjeranc November 13, 2026 16:30

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants